﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Max.PH4.Shoppgin.Admin.DataAccess.Migrations
{
    public partial class addtablespusku : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "tb_sku",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false,defaultValueSql:"newid()"),
                    SPUId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Specs = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Stock = table.Column<int>(type: "int", nullable: true,defaultValue:"0"),
                    ValidStock = table.Column<int>(type: "int", nullable: true, defaultValue: "0"),
                    LockStock = table.Column<int>(type: "int", nullable: true, defaultValue: "0"),
                    SalePrice = table.Column<decimal>(type: "decimal(18,2)", nullable: true, defaultValue: "0"),
                    InPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: true, defaultValue: "0"),
                    MarketPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: true, defaultValue: "0"),
                    SaleNumber = table.Column<int>(type: "int", nullable: true, defaultValue: "0"),
                    Flag = table.Column<string>(type: "nvarchar(max)", nullable: true, defaultValue: "00000000"),
                    IsUp = table.Column<bool>(type: "bit", nullable: true, defaultValue: "True"),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: "False"),
                    CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "getdate()"),
                    UpdatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_sku", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_sku_iamge",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "newid()"),
                    SKUId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Url = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Sort = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: "False"),
                    CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "getdate()"),
                    UpdatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_sku_iamge", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_spu",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "newid()"),
                    CategoryId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    BrandId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: "False"),
                    CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "getdate()"),
                    UpdatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_spu", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_spu_spec",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "newid()"),
                    SPUId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SpecName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SpecValue = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Sort = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_spu_spec", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "tb_sku");

            migrationBuilder.DropTable(
                name: "tb_sku_iamge");

            migrationBuilder.DropTable(
                name: "tb_spu");

            migrationBuilder.DropTable(
                name: "tb_spu_spec");
        }
    }
}
